﻿//党明
var ajaxurl = "/home/as/AjaxHomeCommon.aspx";
$(document).ready(function () {
    if ($("#btnSearch")) {
        $("#btnSearch").bind("click", OrderSearch).css({ cursor: "pointer" });
    }
});

function goPage(pageno) {
    var Action = "ShowOrderInfo";
    var data = "pagesize=" + pagesize;
    data += "&page=" + pageno;
    var success = function (ret) {
        $(".tbody>.orderTr").remove();
        $(".tbody").append($(ret));
        window.location.href = "#top";
    }
    var posttype = "GET";
    var datatype = "JSON";
    AjaxOrderPost(Action, success, posttype, data);
}

function OrderSearch() {
    var url = ajaxurl + "?Action=ShowOrderInfo&r=" + Math.random();
    var data = Array();
    data.push("pagesize=" + pagesize);
    if ($("#datearea>option:selected")) {
        data.push("dataarea=" + $("#datearea>option:selected").val());
    }
    if ($("#orderstatus>option:selected")) {
        data.push("orderstatus=" + $("#orderstatus>option:selected").val());
    }
    if ($.trim($("#orderInfo").val())) {
        data.push("keyword=" + $.trim($("#orderInfo").val()));
    }
    data.push("curpage=0");
    var success = function (ret) {
        $(".orderstable>tbody").html("").html(ret);
    }
    AjaxOrderPost("ShowOrderInfo", success, "GET", data.join("&"));
}

function AjaxOrderPost(action, success, posttype, data) {
    var url = ajaxurl + "?Action=" + action + "&r=" + Math.random();
    $.ajax(
    {
        type: posttype,
        url: url,
        data: data,
        success: success
    });
}